#ifndef BOXCELLDATAIMPORTERVISITORIMPL_H_JM_20120819
#define BOXCELLDATAIMPORTERVISITORIMPL_H_JM_20120819

// ##
#include "BoxCellDataImporterVisitor.h"

namespace jm4bbx {

	template<class BoxType>
	struct BoxCellDataImporterVisitorImpl : public BoxCellDataImporterVisitor {

		BoxCellDataImporterVisitorImpl(BoxType* box) 
			: box_(box) 
			, row_(0)
			, col_(0) { }

		virtual void setContext(size_t row, size_t col) override {
			row_ = row;
			col_ = col;
		}

		virtual void visit(BaseCell*) {
			assert(false); // BaseCell je abstraktna trieda!
		}

		virtual void visit(IntCell* val) {
			box_->setData<bobox::int_policy>(col_, row_, val->getValue());
		}
		virtual void visit(StringCell* val) {
			box_->setData<bobox::string_policy>(col_, row_, val->getValue());
		}

	private:
		BoxType* box_;
		size_t row_;
		size_t col_;
	};
	
} // namespace jm4bbx

#endif
